<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title>成员选择</title>
	<link type="text/css" href="/css/gm.css" rel="stylesheet" />
	<script type="text/javascript" src="/js/jquery-1.11.3.min.js"></script>
	<script type="text/javascript" src="/js/coo.js"></script>
	<link type="text/css" href="/css/datepicker.css" rel="stylesheet">
</head>
<body>
<form class="form-inline" action="?" method="get" style="padding-bottom:5px;">
<input type="hidden" name="app" id="app" value="member" />
<input type="hidden" name="act" id="act" value="choose" />
<input type="text" class="input-medium" placeholder="关键词" name="keyword" value="{$keyword}" /> 
<input type="text" class="input-medium" placeholder="邀请人手机" name="invite_code" value="{$invite_code}" /> 
<input type="text" class="form-control" name="begin_date" id="begin_date" placeholder="开始日期" value="{$begin_date}" initdate="" style="width:150px;" />
 -
<input type="text" class="form-control" name="end_date" id="end_date" placeholder="结束日期" value="{$end_date}" initdate="" style="width:150px;" />

<select name="status" id="status" class="form-control">
	<option value="">状态</option>
	<option value="0" {if $status==='0'}selected{/if}>冻结</option>
	<option value="1" {if $status==='1'}selected{/if}>正常</option>
</select> 
<select name="member_type" id="member_type" class="form-control">
	<option value="">会员类型</option>
	<option value="1" {if $member_type=='1'}selected{/if}>普通会员</option>
	<option value="2" {if $member_type=='2'}selected{/if}>商家</option>
	<option value="3" {if $member_type=='3'}selected{/if}>门店会员</option>
</select>
<button type="submit" class="btn btn-info btn-sm">
	<i class="ace-icon fa fa-search bigger-110"></i>搜索
</button>
</form>

<table id="simple-table" class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th>ID</th>
			<th>头像</th>
			<th>会员名称</th>
			<th>手机号码</th>
			<th>邀请人</th>
			<th>类型</th>
			<th>状态</th>
			<th>余额</th>
			<th>佣金</th>
			<th>登录次数</th>
			<th>登录时间</th>
			<th>操作</th>
		</tr>
	</thead>

	<tbody>
		{foreach from=$rs item=row name=row}
		<tr>
			<td>{$row.id}</td>
			<td style="text-align:left;"><a href="?app=member&act=edit&member_id={$row.id}"><img src="{if $row.avatar}{$row.avatar}{else}/images/default_avatar.png{/if}" width="50" /></a></td>
			<td style="text-align:left;"><a href="?app=member&act=edit&member_id={$row.id}">{$row.nick_name}</a></td>
			<td style="text-align:left;">{$row.mobile}</td>
			<td style="text-align:left;">{$row.invitor}</td>
			<td style="text-align:left;">{$row.member_type_name}</td>
			<td style="text-align:left;">{$row.status_name}</td>
			<td style="text-align:left;">{$row.money}</td>
			<td style="text-align:left;">{$row.commission}</td>
			<td style="text-align:left;">{$row.logins}</td>
			<td style="text-align:left;">{$row.last_time|date_format:"%Y-%m-%d"}</td>
			<td>
					<a href="#" id="{$row.id}" onclick="onget({$row.id})" class="ico2" style="color:blue;"><input type="hidden" value="{$row.name}">添加</a>
				</td>
		</tr>
		{foreachelse}
		<tr bgcolor="white"><td colspan="13" height="50">暂无记录</td></tr>
		{/foreach}	
		
	</tbody>
</table>
	<div class="mypage" style="text-align:right">
			共 {$page.num_records} 个记录  {$page.current_page} / {$page.num_pages} 页  {$page.first_page} {$page.prev} {$page.nav} {$page.next} {$page.last_page}
	</div>


<script>
$(function(){
	$('#begin_date').datepicker({
		useStyle:'datepicker2',
		readonly:false,
		showTime:true,
		showSecond:false,
		format:'yyyy-mm-dd hh:nn'
	});
	$('#end_date').datepicker({
		useStyle:'datepicker2',
		readonly:false,
		showTime:true,
		showSecond:false,
		format:'yyyy-mm-dd hh:nn'
	});
});
</script>
<script>
    var members=window.opener.document.getElementById("members");
	function onget(id){
        var a =document.getElementById(id);
        var name=a.getElementsByTagName("input")[0].value;
        window.opener.document.getElementById("all_members").style.display="";
        if(members.childElementCount==0)
        {
            members.innerHTML = "<div id='"+id+"' style='float:left;position:relative;margin-right:10px;'><input id='"
                    +id+"' type='hidden' name='members[]' value="
                    + id + "><label  style='padding: 5px;margin-right:5px;background: #efefef'>" +id+" : "+ name
                    + "</label><input type='image' src='/images/gm/horum_img_delete.png' width='10' height='10' style='position:absolute;right:-0.5px;top:-8.5px;' onclick='javascript:onDel("
                    +id+");'></div>";
        }else
        {
            members.innerHTML += "<div id='"+id+"' style='float:left;position:relative;margin-right:10px;'><input id='"
                    +id+"' type='hidden' name='members[]' value="
                    + id + "><label  style='padding: 5px;margin-right:5px;background: #efefef'>" +id+" : "+ name
                    + "</label><input type='image' src='/images/gm/horum_img_delete.png' width='10' height='10' style='position:absolute;right:-0.5px;top:-8.5px;' onclick='javascript:onDel("
                    +id+");'></div>";
        }
        document.getElementById("i").value = 1;
        document.getElementById(id).setAttribute("onclick","dele("+id+")");
        document.getElementById(id).onclick=function(){
            var picdiv = members.getElementById(id);
            picdiv.parentNode.removeChild(picdiv);
        };
	}
</script>

